package cn.tedu.blog.server.quartz;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class QuartzConfig {

    @Bean
    public JobDetail loadArticle(){
        return JobBuilder.newJob(LoadArticleJob.class)
                .withIdentity("loadArticle")
                .storeDurably()
                .build();
    }

    @Bean
    public Trigger  loadArticleTrigger(){
        CronScheduleBuilder cron=
                CronScheduleBuilder.cronSchedule("0 0 1 * * ? ");
        return TriggerBuilder.newTrigger()
                .forJob(loadArticle())
                .withIdentity("addTrigger")
                .withSchedule(cron)
                .build();

    }






}
